import java.util.HashMap;
import java.util.Scanner;

public class mindGuessing {
    public static void main(String[] args) {
        HashMap Name=new HashMap();
        Name.put(1,'张');
        Name.put(10,'王');
        Name.put(11,'李');
        Name.put(100,'赵');
        Name.put(101,'刘');
        Name.put(110,'于');
        Name.put(111,'许');
        Name.put(1000,'金');
        Name.put(1001,'钱');
        Name.put(1010,'孙');
        System.out.println("1:金钱孙\n2:赵刘于许\n3:王李于许孙\n4：张李刘许钱");
        System.out.println("请输入所想的姓氏所在的位置：（以-1表示结束）");
        int get, temp= 0;
        int[] group = new int[4];
        Scanner in = new Scanner(System.in);
        while ((get = in.nextInt()) != -1) {
            group[temp] = get;
            temp++;
        }
        int num= 0;
        for (int j = 0; j < group.length; j++) {
            if (group[j] == 1) {
                num = num + 1000;
            } else if (group[j] == 2) {
                num = num + 100;
            } else if (group[j] == 3) {
                num = num + 10;
            } else if (group[j] == 4) {
                num = num + 1;
            }
        }
        System.out.println(num);
        System.out.println(Name.get(num));


    }
}
